<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tiny 框架 Demo</title>
    <link rel="stylesheet" href="/static/css/style.css">
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            color: #333;
            max-width: 800px;
            margin: 0 auto;
        }
        h1 {
            color: #0066cc;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }
        .card {
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 15px;
            margin-bottom: 20px;
            background-color: #f9f9f9;
        }
        .btn {
            display: inline-block;
            background-color: #0066cc;
            color: white;
            padding: 8px 15px;
            text-decoration: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .btn:hover {
            background-color: #0055b3;
        }
        #responseArea {
            margin-top: 20px;
            padding: 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background-color: #f5f5f5;
            min-height: 100px;
        }
    </style>
</head>
<body>
    <h1>欢迎使用 Tiny 框架</h1>
    
    <div class="card fade-in">
        <h2>关于</h2>
        <p>这是一个基于 Netty 的轻量级 Web 框架，专为边缘计算和物联网应用场景设计。</p>
        <p>它启动快速，资源占用少，稳定可靠。</p>
    </div>
    
    <div class="card fade-in">
        <h2>功能测试</h2>
        <p>点击下面的按钮测试 HTTP 请求功能：</p>
        <button class="btn" onclick="testHello()">测试 /hello 接口</button>
        <div id="responseArea">
            <p>响应将显示在这里...</p>
        </div>
    </div>
    
    <div class="footer">
        <p>Tiny 框架 &copy; 2025 北芝科技</p>
    </div>
    
    <script>
        function testHello() {
            fetch('/hello')
                .then(response => response.text())
                .then(data => {
                    document.getElementById('responseArea').innerHTML = 
                        '<p><strong>状态:</strong> 成功</p>' +
                        '<p><strong>响应:</strong> ' + data + '</p>';
                })
                .catch(error => {
                    document.getElementById('responseArea').innerHTML = 
                        '<p><strong>状态:</strong> 失败</p>' +
                        '<p><strong>错误:</strong> ' + error.message + '</p>';
                });
        }
    </script>
</body>
</html> 